import React from 'react';
import { injectIntl } from 'react-intl';
import { withRouter } from 'react-router-dom';
import Grid from '../../components/table/grid';

@withRouter
class chargePermit extends React.Component{
    constructor(props){
        super(props);
        if(!this.props.location.state){
            this.props.history.go(-1)
        }
        this.state={
            refresh:0,
            params:{
                stubId:this.props.location.state
            }
        }
        this.columns=[
            {
                title: 'Other',
                children:[
                    {
                        title: '最后变更时间',
                        dataIndex: 'time',
                        key: 'time',
                        width: 200,
                    },
                    {
                        title: 'VIN',
                        dataIndex: 'VIN',
                        key: 'VIN',
                        width: 200,
                    },
                    {
                        title: '电卡',
                        dataIndex: 'card',
                        key: 'card',
                        width: 200,
                    }
                ]
            }
        ]
    }

    transformData=(data)=>{
        return data
    }

    render(){
        return(
            <div>
                <Grid transformData={this.transformData} refresh={this.state.refresh} params={this.state.params}
                      columns={this.columns} url="/api/stub/config/detail"/>
            </div>
        )
    }
}

export default injectIntl(chargePermit)

